package com.by.service;


import com.by.dao.PersonDao;
import com.by.dao.PersonMapper;
import com.by.pojo.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description: 业务层，处理业务
 * @Param: * @param null
 * @return:
 * @Author: GP
 * @Date: 2024/1/17
 */
@Service //作用：new UserServiceImpl(),并放到容器中
public class PersonServiceImpl implements PersonService {

    @Autowired  //作用，从容器里把new PersonDaoImpl()拿出来，并赋值给personDao
    private PersonMapper personMapper;

    @Override
    public Person getPersonById(Integer id) {
        //复杂的业务

        return personMapper.getPersonById(id);
    }

    @Override
    public void delPersonById(Integer id) {
        personMapper.delPersonById(id);
    }

    @Override
    public void addPerson(Person person) {
        personMapper.addPerson(person);
    }

    @Override
    public void editPerson(Person person) {
        personMapper.editPerson(person);
    }
}
